1. Field of the Invention
The present invention relates to a motion compensator for restoring a digital image, which restores the original digital image by decoding digital data compressed using the motion of the digital image, and, more particularly, to a motion compensator for restoring a digital image, which receives data of a motion search area quickly and then efficiently processes the data, thereby compensating for the motion in real time.
2. Discussion of the Related Art
Generally, an image decoder for protecting compressed digital image data and restoring it to the original digital image, as shown in FIG. 1, comprises an inverse quantizer 1 for inverse quantizing digital data input from a variable length decoder (VLD), an inverse discrete cosine transformer (IDCT) 2 for IDCT-transforming the output signal of inverse quantizer 1, an adder 3 for adding a motion-compensated estimation signal of the present frame to the output signal of IDCT 2, a frame memory 4 for temporarily storing and outputting the output signal of adder 3, and a motion compensator 5 for estimating a motion-compensated present frame by accessing the preceding frame data stored in frame memory 4 and using the motion information output from the VLD, and outputting the estimated result to adder 3.
The image decoder inverse-quantizes the digital data input from the VLD in inverse quantizer 1, and the IDCT-transforming the inverse-quantized data in IDCT 2. The resulting data is input to adder 3.
If the input digital data, is a digital signal coded by motion estimation, the motion compensator 5 accesses the data of the preceding frame stored in frame memory 4 and estimates the present frame, compensating for motion according to the motion information output from the VLD. The estimated data is output to adder 3.
Adder 3 adds the signal output from IDCT 2 to the signal output from motion compensator 5, and then outputs the added result as a digital image of the present invention. The output digital image is restored in frame memory 4 for use in estimating a present frame.
In the case where a macro block is used in coding units of motion information, i.e., motion vectors, the relationship between the macro block and the motion search area will be explained below with reference to FIG. 2.
Given that the size of macro block 11 is J.times.K, that the vertical search range of motion search area 12 lies within M' and M, and that the horizontal search range thereof is N' and N, the size of motion search area 12 becomes (M'+M+J).times.(N'+N+K).
FIG. 3 is a circuit diagram of a conventional motion compensator 5. As shown in FIG. 3, motion compensator 5 comprises a controller 20 for outputting enable signals EN21-EN24 and switching signals S21 and S22 which are intended to control the motion compensation of an input digital image signal PIX. Buffers 21 and 22 are selectively enabled according to enable signals EN21 and EN22 output from the controller 20, for passing the input digital image signal PIX to frame memories 23 and 24 for temporarily storing and outputting the output signals of buffers 21 and 22 in units of a frame. Buffers 25 and 26 are selectively enabled according to enable signals EN23 and EN24, output from the controller 20, for passing the output signals of frame memories 23 and 24. A motion compensator 27 outputs an address signal ADDR22, according to the motion information input from the VLD, compensating for the motion of the digital image using the output signals of buffers 25 and 26, and outputting the compensation result to the adder 3. Multiplexers 28 and 29 selectively apply address signal ADDR21, input in synchronization with input digital image signal PIX, and address signal ADDR22, output from motion compensator 27, to frame memories 23 and 24 according to switching signals S21 and S22 output from the controller 20.
The conventional motion compensator 5 requires two frame memories 23 and 24 in order to compensate for the motion of digital image signal PIX input from adder 3. When one frame memory stores frame data of digital image signal PIX, motion compensator 27 accesses the frame data stored in the other frame memory for the purpose of motion compensation.
Specifically, buffers 21 and 25 are enabled according to enable signals EN21 and EN23 output from controller 20. Multiplexers 28 and 29 selectively output address signals ADDR22 and ADDR21, according to switching signals S21 and S22, the frame memory 24 sequentially stores the digital image signal PIX of the present frame, having passed buffer 21, according to address signal ADDR21, which multiplexer 29 selectively outputs. Frame memory 23 outputs the stored digital image signal of the preceding frame according to an address signal ADDR22, which the multiplexer 28 selectively outputs to motion compensator 27 via buffer 25.
Next, buffers 22 and 26 are enabled according to enable signals EN22 and EN24 output from the controller 20, and multiplexers 28 and 29 selectively output address signals ADDR21 and ADDR22 according to switching signals S21 and S22. Frame memory 23 sequentially stores the digital image signal PIX, having passed buffer 22, according to an address signal ADDR21 which the multiplexer 28 selectively outputs. Frame memory 24 inputs the stored digital image signal to motion compensator 27 via buffer 26 according to the address signal ADDR22 which multiplexer 29 outputs. This operation is performed repeatedly.
Given that motion information, that is, a motion vector at pixel position (X,Y), is MV.sub.x,MV.sub.y horizontally and vertically, the motion compensator 27 accesses frame memories 23 and 24 which have stored the digital image data of the preceding frame, and output address signal ADDR22. Motion compensation is performed as in the following equations I-IV and the result is output to the adder. EQU P.sub.t (X,Y)=P.sub.t-1 (X-MV.sub.x,Y-MV.sub.y) (I) EQU P.sub.t-1 (X+0.5,Y)={P.sub.t-1 (X,Y)+P.sub.t-1 (X+1,Y)}/2 (II) EQU P.sub.t-1 (X,Y+0.5)={P.sub.t-1 (X,Y)+P.sub.t-1 (X,Y+1)}/2 (III) EQU P.sub.t-1 (X+0.5,Y+0.5)={P.sub.t-1 (X,Y)+P.sub.t-1 (X+1,Y)+P.sub.t-1 (X,Y+1)+P.sub.t-1 (X+1,Y+1)}/4 (IV)
Here, P.sub.t-1 (X,Y) is digital image data of the preceding frame. P.sub.t (X,Y) is the output signal of motion compensator 27 and is added to the output signal of IDCT 2, thereby forming image data of the present invention. Equations II-IV are designed to form a pixel value for every one-half of one pixel when the motion vector corresponds to one-half of one pixel.
The conventional motion compensator, however, needs a great amount of calculation for motion compensation per pixel so that operation is performed by receiving only pixels requiring motion compensation from the frame memory. If the size of the frame is large, the amount of calculation required becomes extremely great and is very hard to perform in real time. Further, the calculation amount varies whether the motion vector is an integer or a one-half of one pixel, thereby changing the overall time of calculation.